package com.pignest.hotel.test.initialize;

import com.pignest.hotel.beans.MemberLevel;
import com.pignest.hotel.beans.Role;
import com.pignest.hotel.beans.Room;
import com.pignest.hotel.beans.RoomType;
import com.pignest.hotel.beans.TbGoods;
import com.pignest.hotel.definition.Color;
import com.pignest.hotel.definition.GoodsType;
import com.pignest.hotel.service.DictionaryService;
import com.pignest.hotel.service.GoodsService;
import com.pignest.hotel.service.MemberService;
import com.pignest.hotel.service.RoomService;
import com.pignest.hotel.service.UserService;
import com.pignest.hotel.spring.Services;
import com.pignest.hotel.system.Key;
import com.pignest.hotel.system.Permission;

public class SevenHotelInitialize extends BaseInitialize {
	
	@Override
	public void testInitAll() {
		super.testInitAll();
	}
	
	public void _testInitFloors() {
		DictionaryService service = Services.getDictionaryService();
		service.saveDictionaries(Key.FLOORS, "[二楼,三楼]");
	}
	
	public void _testInitRoomType() {
		RoomService service = Services.getRoomService();
		service.addRoomType(new RoomType("标单A", "FF0000", 1, 20700, 17700, 7700, 5700, 10700, 9700));
		service.addRoomType(new RoomType("标双A", "0000FF", 1, 20700, 17700, 7700, 5700, 10700, 9700));
		service.addRoomType(new RoomType("标单B", "800080", 1, 20700, 17700, 7700, 5700, 10700, 9700));
		service.addRoomType(new RoomType("标双B", "FFA500", 1, 20700, 17700, 7700, 5700, 10700, 9700));
		service.addRoomType(new RoomType("套房",  "FF0080", 1, 20700, 17700, 7700, 5700, 10700, 9700));
	}

	public void _testInitRoom() {
		RoomService service = Services.getRoomService();
		RoomType type1 = service.getRoomTypeByName("标单A");
		RoomType type2 = service.getRoomTypeByName("标双A");
		RoomType type3 = service.getRoomTypeByName("标单B");
		RoomType type4 = service.getRoomTypeByName("标双B");
		RoomType type5 = service.getRoomTypeByName("套房");
		service.addRoom(new Room("7201", type1, "二楼", Color.GREEN,  "EC720001"));
		service.addRoom(new Room("7202", type1, "二楼", Color.ORANGE, "EC721001"));
		service.addRoom(new Room("7203", type1, "二楼", Color.GREEN,  "EC722001"));
		service.addRoom(new Room("7204", type1, "二楼", Color.ORANGE, "EC723001"));
		service.addRoom(new Room("7205", type1, "二楼", Color.GREEN,  "EC724001"));
		service.addRoom(new Room("7206", type1, "二楼", Color.ORANGE, "EC725001"));
		service.addRoom(new Room("7207", type1, "二楼", Color.GREEN,  "EC726001"));
		service.addRoom(new Room("7208", type1, "二楼", Color.ORANGE, "EC727001"));
		service.addRoom(new Room("7209", type1, "二楼", Color.GREEN,  "EC728001"));
		service.addRoom(new Room("7210", type5, "二楼", Color.ORANGE, "EC729001"));
		service.addRoom(new Room("7211", type2, "二楼", Color.YELLOW, null));
		service.addRoom(new Room("7212", type2, "二楼", Color.YELLOW ,null));
		service.addRoom(new Room("7213", type2, "二楼", Color.RED, null));
		service.addRoom(new Room("7214", type2, "二楼", Color.RED, null));
		service.addRoom(new Room("7215", type2, "二楼", Color.RED, null));
		service.addRoom(new Room("7216", type2, "二楼", Color.PINK, null));
		service.addRoom(new Room("7217", type2, "二楼", Color.PINK, null));
		service.addRoom(new Room("7218", type2, "二楼", Color.PURPLE, null));
		service.addRoom(new Room("7219", type2, "二楼", Color.PURPLE, null));
		service.addRoom(new Room("7220", type2, "二楼", Color.YELLOW, null));
		service.addRoom(new Room("7221", type2, "二楼", Color.YELLOW, null));
		
		service.addRoom(new Room("7301", type3, "三楼", Color.PURPLE, "EC720002"));
		service.addRoom(new Room("7302", type3, "三楼", Color.RED,    "EC720002"));
		service.addRoom(new Room("7303", type3, "三楼", Color.RED,    "EC720002"));
		service.addRoom(new Room("7304", type3, "三楼", Color.PURPLE, "EC720002"));
		service.addRoom(new Room("7305", type3, "三楼", Color.RED,    "EC720002"));
		service.addRoom(new Room("7306", type3, "三楼", Color.PURPLE, "EC720002"));
		service.addRoom(new Room("7307", type3, "三楼", Color.RED,    "EC720002"));
		service.addRoom(new Room("7308", type3, "三楼", Color.PURPLE, "EC720002"));
		service.addRoom(new Room("7309", type3, "三楼", Color.PURPLE, "EC720002"));
		service.addRoom(new Room("7310", type5, "三楼", Color.RED,    "EC720002"));
		service.addRoom(new Room("7311", type4, "三楼", Color.YELLOW, null));
		service.addRoom(new Room("7312", type4, "三楼", Color.YELLOW, null));
		service.addRoom(new Room("7313", type4, "三楼", Color.YELLOW, null));
		service.addRoom(new Room("7314", type4, "三楼", Color.YELLOW, null));
		service.addRoom(new Room("7315", type4, "三楼", Color.RED, null));
		service.addRoom(new Room("7316", type4, "三楼", Color.RED, null));
		service.addRoom(new Room("7317", type4, "三楼", Color.RED, null));
		service.addRoom(new Room("7318", type4, "三楼", Color.PURPLE, null));
		service.addRoom(new Room("7319", type4, "三楼", Color.PURPLE, null));
		service.addRoom(new Room("7320", type4, "三楼", Color.GREEN, null));
		service.addRoom(new Room("7321", type4, "三楼", Color.GREEN, null));
	}
	
	public void _testInitMemberLevel() {
		MemberService service = Services.getMemberService();
		service.addMemberLevel(new MemberLevel("金卡1"));
		service.addMemberLevel(new MemberLevel("金卡2"));
		service.addMemberLevel(new MemberLevel("金卡3"));
	}
	
	public void _testInitRole() {
		UserService service = Services.getUserService();
		service.insert(new Role("前台", Permission.BOOKING, Permission.RECEPTION, Permission.ROOM_STATUS, Permission.MEMBER_MANAGER));
		service.insert(new Role("经理", Permission.ROOM_STATUS, Permission.MEMBER_MANAGER, Permission.REPORT, Permission.SELF_SERVICE));
		service.insert(new Role("管理员", Permission.values()));
	}
	
	public void _testInitUser() {
		UserService service = Services.getUserService();
		service.insertSuperUser();
	}
	
	public void _testInitMemberPrice() {
		MemberService service = Services.getMemberService();
		service.initMemberPrices();
	}
	
	public void _testInitGoods() {
		GoodsService service = Services.getGoodsService();
		service.insert(new TbGoods("矿泉水", 500, GoodsType.OnConsume.name()));
		service.insert(new TbGoods("方便面", 500, GoodsType.OnConsume.name()));
		service.insert(new TbGoods("卜克", 500, GoodsType.OnConsume.name()));
		service.insert(new TbGoods("电风吹", 5000, GoodsType.OnBorrow.name()));
	}
}
